let uu = document.querySelector('#product ul')
fetch('http://chst.vip:1234/api/getinlanddiscount')
    .then(body => body.json())
    .then(res => {
        console.log(res)
        let el = ""
        res.result.forEach(item => {
            let regExp = /^<[^<]+\s+src="([^''""]*)"/;
            let reg = item.productImg.match(regExp);
            console.log(reg)
            el += `<li productid=${item.productId}>
            <a>
            <img src=${reg[1]} productid=${item.productId}>
            <div productid=${item.productId}>
                <h4 productid=${item.productId}>${item.productName}</h4>
                <p productid=${item.productId}>${item.productPrice}</p>
            </div>
            </a>
            <span productid=${item.productId}>${item.productFrom}|${item.productTime}</span>
        </li>`
        })
        uu.innerHTML = el
    })
    uu.onclick=  function(e){
        if(e.target.localName=='li' || e.target.localName=='img' || e.target.localName=='h4' || e.target.localName=='div' || e.target.localName=='p' || e.target.localName=='span') {
            let _this = e.target
            let id = _this.getAttribute('productid')
            location.href = './../pages/inlandproduct.html?productid=' + id;
        }
    }